import os
import json

path = r"D:\Project\multimoding\data\数据集"

exiting_data = []

with open(os.path.join(path, 'data - 1.json'), 'r') as fp:
    datas = json.load(fp)

for data in datas:
    if os.path.exists(os.path.join(path, ''.join([str(data['id']), '.jpg']))):
        exiting_data.append(data)

with open(os.path.join(path, 'data.json'), 'w') as fp:
    json.dump(exiting_data, fp)



